import Head from 'next/head';
import { InstallCommand } from '../../../components/mdx/InstallCommand';

<Head>
  <title>
    {'Migrating to Material React Table V3 - Material React Table V3 Docs'}
  </title>
  <meta
    name="description"
    content="Migrating to Material React Table V3 from V2"
  />
</Head>

## Migrating to Material React Table V3 from V2

This will be the easiest MRT upgrade ever! Material React Table V3 is mostly just a peer dependency bump to Material UI V6. The [Material UI V6 migration](https://mui.com/material-ui/migration/upgrade-to-v6/) is also relatively easy. This should take less than an hour to upgrade in most cases. Definitely a stark contrast from the Material UI V4 to V5 upgrade 💀.

### New Feature Highlights

1. Compatible with Material UI V6 with generally better performance across the board
2. Keyboard navigation improvements that are now included by default
3. **Almost no other changes**. MRT is not taking advantage of the new optional features in Material UI V6 yet. MRT V3 will serve as an easy upgrade target for those who are just looking to upgrade their Material UI package versions.

### Upgrade Dependencies

1. Upgrade Material UI to V6

Before upgrading Material React Table, you need to upgrade Material UI to V6. You will spend most of your time here. Follow the [Material UI V6 migration guide](https://mui.com/material-ui/migration/upgrade-to-v6/) to upgrade your Material UI packages.

You can get started by running the following command to set the mui-related dependencies to the latest versions in your `package.json`. This will not perform the full install yet.

```bash
npx npm-check-updates -u @mui/material @mui/x-date-pickers @mui/icons-material @emotion/react @emotion/styled
```

And then perform the actual install (downloading the new versions):

<InstallCommand packagesString="@mui/material @mui/x-date-pickers @mui/icons-material @emotion/react @emotion/styled" />

2. Upgrade Material React Table to V3

Run this command to set the `material-react-table` dependency to the latest version in your `package.json`. This will not perform the full install yet.

```bash
npx npm-check-updates -u material-react-table
```

And then perform the actual install (downloading the new version):

<InstallCommand packagesString="" />

You should now be on Material React Table V3! Look for any code or type errors in your project and fix them as needed.

### Breaking Changes

- `@mui/material` and `@mui/icons-material` v6.0.0 are now minimum required versions of Material UI packages (you might be able to get away with lower MUI versions for a while, but eventually MUI V6 APIs will be used internally by MRT and your project will break)
- `@mui/x-date-pickers` v7.15.0 is now a minimum required dependency
- `react` and `react-dom` v18.0.0 are now a minimum required dependencies (some React 18 APIs are now used internally by MRT)
- Keyboard navigation for table cells in now enabled by default. If you had added your own custom keyboard shortcuts, you may want to set `enableKeyboardShortcuts` to `false` or remove your custom shortcuts.
- Removed deprecated `MRT_Virtualizer` type in favor of separate `MRT_RowVirtualizer` and `MRT_ColumnVirtualizer` types
- Removed deprecated `text` in favor of the more consistent `label` type in dropdown/autocomplete/select option types.

> Note: As of MRT V3.1.0, some muiProps that were initially marked as deprecated in V3.0.0 are no longer deprecated until a future version of TanStack Table comes out that handles `defaultColumn` options merging better.

> Can I uninstall Emotion Yet? No, Emotion is still required for Material React Table V3, but it won't be for long. MRT V4 will remove the Emotion dependency in favor of [Pigment CSS](https://mui.com/blog/introducing-pigment-css/).

<br />

Is anything missing from this v3 migration guide? Make a PR or join the [Discord](https://discord.gg/5wqyRx6fnm) to discuss.

Looking for the v1 to v2 migration guide? [Click here](https://v2.material-react-table.com/docs/getting-started/migrating-to-v2)
